package cn.jiyun.mapper;

import cn.jiyun.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface UserMapper {

    @Insert("insert into users(nam,pwd,sex,birth) values (#{nam},#{pwd},#{sex},#{birth})")
    public void insertUser(User user);


    @Select("select * from users")
    public List<User> listUser();

    @Select("select * from users where nam=#{nam} and pwd=#{pwd}")
    User login(User user);

    @Delete("delete from users where id=${id}")
    void delUser(@Param("id") Integer id);

    @Select("select * from users where id=${id}")
    User toUpdate(@Param("id") Integer id);

    @Update("update users set nam=#{nam},pwd=#{pwd},sex=#{sex},birth=#{birth} where id=#{id}")
    void updateUser(User user);

}
